package com.jketing.entity.ams.base;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;

import com.jketing.entity.BaseEntity;

/**
 * Education 学历实体
 * 
 * @author  李荣华
 * @version v1.0
 * @date     2018-07-08
 * @since   Jpa 2.1
 */
@Entity
@Table(name = "Education_")
public class Education extends BaseEntity {	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1239567807949487233L;
	/**
	 * certificateNo:证书编号
	 */
	private String certificateNo;
	/**
	 * enrollmentDate:入学日期
	 */
	private Date enrollmentDate;
	/**
	 * graduationDate:毕业日期
	 */
	private Date graduationDate;
	/**
	 * type:培养类型
	 */
	private Dictionary type;
	/**
	 * level:培养层次
	 */
	private Dictionary level;
	/**
	 * schoolName:学校名称
	 */
	private String schoolName;
	/**
	 * specialty:所学专业
	 */
	private String specialty;
	
	public String getCertificateNo() {
		return certificateNo;
	}
	public void setCertificateNo(String certificateNo) {
		this.certificateNo = certificateNo;
	}

	@DateTimeFormat(pattern="yyyy-MM-dd")
	@Temporal(value = TemporalType.DATE)
	public Date getEnrollmentDate() {
		return enrollmentDate;
	}
	public void setEnrollmentDate(Date enrollmentDate) {
		this.enrollmentDate = enrollmentDate;
	}
	
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@Temporal(value = TemporalType.DATE)
	public Date getGraduationDate() {
		return graduationDate;
	}
	public void setGraduationDate(Date graduationDate) {
		this.graduationDate = graduationDate;
	}

	@ManyToOne
	@JoinColumn(name = "TypeId")
	public Dictionary getType() {
		return type;
	}
	public void setType(Dictionary type) {
		this.type = type;
	}

	@ManyToOne
	@JoinColumn(name = "LevelId")
	public Dictionary getLevel() {
		return level;
	}
	public void setLevel(Dictionary level) {
		this.level = level;
	}
	
	public String getSchoolName() {
		return schoolName;
	}
	public void setSchoolName(String schoolName) {
		this.schoolName = schoolName;
	}

	public String getSpecialty() {
		return specialty;
	}
	public void setSpecialty(String specialty) {
		this.specialty = specialty;
	}

	/**
	 * 	equals 判断实例是否相等
	 * 
	 * 	是本类实例并且实例id值相等返回true
	 * 	其它情况返回false
	 * 
	 * 	@param object 其它实例
	 */
	@Override
	public boolean equals(Object object) {
		if (!(object instanceof Education)) {
			return false;
		}
		Education other = (Education) object;
		if(!id.equals(other.id)){
			return false;
		}
		return true;
	}
}
